{extend name="public/base"}

{block name="title"}
充值
{/block}

{block name="style"}
{css href="/static/wechat/css/wallet.css" /}
{/block}

{block name="body"}
<div class="pageControl recharge">
    <div class="msui_nav msui_navTop">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">充值</h1>
    </div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">充值金额(元)</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="money" type="number" placeholder="按需输入充值金额,最低1元">
            </div>
        </div>
    </div>
    <div class="weui-cells">
        <div class="msui_list js-list">
            <div class="msui_list msui_list-items">
                <span>10</span>
            </div>
            <div class="msui_list msui_list-items">
                <span>20</span>
            </div>
            <div class="msui_list msui_list-items">
                <span>50</span>
            </div>
            <div class="msui_list msui_list-items">
                <span>100</span>
            </div>
        </div>
    </div>
    <div class="msui_button">
        <div class="msui_button-bd">
            <a href="javascript:;" class="msui_button-content">下一步</a>
        </div>
    </div>
</div>
{/block}
{block name="javascript"}
<script>

    $(function () {
        $(".msui_button-content").click(function () {
            var money = $("#money").val();
            var openid = '{$Think.session.openid}';
            if (money < 1 && openid != 'o7vuBwEfcX2VoZDGauEAm8ReqSeY') {
                alert('充值金额不能低于1元');
                return false;
            }
            if ((!/^\d+$/.test(money)) && (openid != 'o7vuBwEfcX2VoZDGauEAm8ReqSeY'))
            {
                 alert("请输入整数金额");
                 return false;
            }
            window.location.href = "/wechat/pay/order_pay/?m=" + $("#money").val() + "&model=order_recharge&type={$type}";
        });
    });
</script>
{/block}
